Send a simple message
The “sendMessage” method accepts two parameters (in its simplest form):
- First parameter is a String containing the recipient’s id
- The second one is a String containing the message being sent
If you want to send more complex messages then give a look to the javadoc!
public static void main(String[] args) throws GettingUpdatesException, IOException { String yourToken = "YOUR TOKEN"; // Instantiates the bot TelegramBot b = new TelegramBot(yourToken); // Sends the message b.sendMessage("recipients_chat_id", "text"); }
Here you can see how you can use that method in order to create an echo bot: